import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.cloudgarden.resource.SWTResourceManager;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class DetalleQuery extends org.eclipse.swt.widgets.Composite {
	
	private Shell dialogShell;
	public Text txtDetalle;
	private boolean isOpen = false;
	
	public DetalleQuery(Shell parent, int style){
		super(parent, style);
		//super();
	}
	
	public void open(){
		try{
			Shell parent = (Shell) getParent();
			
			dialogShell = new Shell(parent, SWT.DIALOG_TRIM	| SWT.NORMAL);

			{
				// Register as a resource user - SWTResourceManager will
				// handle the obtaining and disposing of resources
				SWTResourceManager.registerResourceUser(dialogShell);
			}

			dialogShell.setLayout(new FormLayout());
			dialogShell.layout();
			dialogShell.pack();
			dialogShell.setSize(471, 355);
			dialogShell.setText("Detalle de Query");
			{
				txtDetalle = new Text(dialogShell, SWT.MULTI | SWT.WRAP);
				FormData txtDetalleLData = new FormData();
				txtDetalleLData.width = 459;
				txtDetalleLData.height = 342;
				txtDetalleLData.left =  new FormAttachment(0, 1000, 4);
				txtDetalleLData.top =  new FormAttachment(0, 1000, 5);
				txtDetalle.setLayoutData(txtDetalleLData);
				txtDetalle.setEditable(false);
				txtDetalle.setFont(SWTResourceManager.getFont("MS Reference Sans Serif", 8, 0, false, false));
			}
			dialogShell.setLocation(getParent().toDisplay(100, 100));
			this.isOpen = true;
			dialogShell.open();
			Display display = dialogShell.getDisplay();
			while (!dialogShell.isDisposed()) {
				if (!display.readAndDispatch())
					display.sleep();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void addText(String text){
		//this.txtDetalle.setText(text+"\n");
		this.txtDetalle.append(text+"\n");
	}
	
	public boolean estaAbierto(){
		return this.isVisible();
	}
	
	
}
